/*
============================================================================
 Name        : Logger.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CLogger declaration
============================================================================
*/

#ifndef __LOGGER_H__
#define __LOGGER_H__

// INCLUDES
#include <e32std.h>
#include <e32base.h>

#include <flogger.h>

#define LOG(x) {iLogger->WriteFormat(_L(x));}
#define LOG1(x, y) {iLogger->WriteFormat(_L(x),y);}
#define LOG8(x) {iLogger->Write(x);}
#define LOG16(x) {iLogger->Write(x);}

class CLogger : public CBase
{
public: // Constructors and destructor
	IMPORT_C ~CLogger();
	IMPORT_C static CLogger* NewL(const TDesC& aFilename);
	IMPORT_C static CLogger* NewLC(const TDesC& aFilename);

private:
	CLogger();
	void ConstructL(const TDesC& aFilename);

public: //new functions
	IMPORT_C void Write(TDesC& aText);
	IMPORT_C void Write(TDesC8& aText);
	IMPORT_C void WriteFormat(TRefByValue<const TDesC16> aFmt, ...);

private: //data
	RFileLogger iLog;
	TBuf<16> iBuf;

};

#endif // __LOGGER_H__
